package com.cloudbroker.openapi.manage.controller;

import static com.cloudbroker.bcs.platform.dav.common.util.RequestUtil.getSingleParameterMapForBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cloudbroker.bcs.common.entity.HSBCPSBackVO;
import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.result.ExtendGroupListResult;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.vo.ExtendAppOrderForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.vo.ExtendGroupBlankForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.vo.ExtendGroupBuildDefaultForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.vo.ExtendGroupUpdateForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.vo.ExtendGroupListForm;
import com.cloudbroker.bcs.platform.dav.bizapi.service.business.plugs.vo.ExtendGroupSaveForm;
import com.cloudbroker.bcs.platform.dav.bizapi.t2service.business.ExtendGroupT2BizService;
import com.cloudbroker.bcs.platform.dav.common.ext.annotation.SaveLog;

@Controller
public class ExtendGroupController {

	@Resource
	private ExtendGroupT2BizService extendGroupT2;
	
	
    @ResponseBody
    @RequestMapping("/func_extendgroup_list")
    @SaveLog(remark = "分组列表")
	public ExtendGroupListResult funcExtendGroupList(HttpServletRequest request,String jsonpcallback) {
    	ExtendGroupBlankForm form = getSingleParameterMapForBody(request, ExtendGroupBlankForm.class);
		return VOUtil.setJsonpResult(extendGroupT2.funcExtendGroupList(form), jsonpcallback);
	}

    @ResponseBody
    @RequestMapping("/func_extendgroup_save")
    @SaveLog(remark = "添加分组")
	public HSBCPSBackVO funcExtendGroupSave(HttpServletRequest request,String jsonpcallback) {
    	ExtendGroupSaveForm form = getSingleParameterMapForBody(request, ExtendGroupSaveForm.class);
		return VOUtil.setJsonpResult(extendGroupT2.funcExtendGroupSave(form), jsonpcallback);
	}

    @ResponseBody
    @RequestMapping("/func_extendgroup_update")
    @SaveLog(remark = "修改分组")
	public HSBCPSBackVO funcExtendGroupUpdate(HttpServletRequest request,String jsonpcallback) {
    	ExtendGroupUpdateForm form = getSingleParameterMapForBody(request, ExtendGroupUpdateForm.class);
    	return VOUtil.setJsonpResult(extendGroupT2.funcExtendGroupUpdate(form), jsonpcallback);
	}

    @ResponseBody
    @RequestMapping("/func_extendgroup_del")
    @SaveLog(remark = "删除分组")
	public HSBCPSBackVO funcExtendGroupDel(HttpServletRequest request,String jsonpcallback) {
    	ExtendGroupListForm form = getSingleParameterMapForBody(request, ExtendGroupListForm.class);
    	return VOUtil.setJsonpResult(extendGroupT2.funcExtendGroupDel(form), jsonpcallback);
	}
    
    @ResponseBody
    @RequestMapping("/func_extendgroup_build_default")
    @SaveLog(remark = "生成默认分组")
	public HSBCPSBackVO funcExtendGroupBuildDefault(HttpServletRequest request,String jsonpcallback) {
    	ExtendGroupBuildDefaultForm form = getSingleParameterMapForBody(request, ExtendGroupBuildDefaultForm.class);
    	return VOUtil.setJsonpResult(extendGroupT2.funcExtendGroupBuildDefault(form), jsonpcallback);
	}
    
	@ResponseBody
	@RequestMapping("func_extendapp_build_group")
	@SaveLog(remark = "生成分组")
	public HSBCPSBackVO funcExtendAppOrder(HttpServletRequest request,String jsonpcallback){
		ExtendAppOrderForm form = getSingleParameterMapForBody(request,ExtendAppOrderForm.class);
		return VOUtil.setJsonpResult(extendGroupT2.funcExtendAppBuildGroup(form), jsonpcallback);
	}

}
